package action;

import manager.ComManager;
import manager.LoadVariousList;
import manager.ObjectFactory;
import bean.CombinaisonBean;
import bean.CreateCombinaisonMessage;


public class ActionCreateCombinaison {
	public CombinaisonBean doCreateCombinaison(CombinaisonBean c){
		ObjectFactory of = new ObjectFactory();
		ComManager com = of.createComManager();
		CreateCombinaisonMessage mOut = of.createCreateCombinaisonMessage();
		CreateCombinaisonMessage mIn ;
		mOut.setCombi(c);
		mOut.getCombi().setIdCoder(LoadVariousList.getIdUser());
		mIn = (CreateCombinaisonMessage)com.sendMessage(mOut);
		if(mIn.getErrors().isEmpty())
		{
			CombinaisonBean combinaisonReturn = mIn.getCombi();
			return combinaisonReturn;
		}
		else
		{
			return null;
		}
	}
}
